<!DOCTYPE html>
<html>
#{include file="header.html"}#
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
  <div class="row">
    <div class="col-sm-12">
      <div class="ibox float-e-margins">
        <div class="ibox-title">
          <h5>栏目添加</h5>
          <div class="ibox-tools"> <a class="collapse-link"> <i class="fa fa-chevron-up"></i> </a> <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#"> <i class="fa fa-wrench"></i> </a>
            <ul class="dropdown-menu dropdown-user">
              <li><a href="form_basic.html#">选项1</a> </li>
              <li><a href="form_basic.html#">选项2</a> </li>
            </ul>
            <a class="close-link"> <i class="fa fa-times"></i> </a> </div>
        </div>
        <div class="ibox-content">
          <form class="form-horizontal" method="post" action="#{$smarty.const.ACT}#/sysmanage/Menu/menu_add/">
            <div class="form-group">
              <label class="col-sm-2 control-label">中文栏目名称</label>
              <div class="col-sm-8">
                <input name="name" class="form-control" type="text" placeholder="请输中文栏目名称" required/>
                <span class="help-block m-b-none"></span> </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">英文栏目名称</label>
              <div class="col-sm-8">
                <input name="name_en" class="form-control" type="text" placeholder="请输栏目英文名称" required/>
                <span class="help-block m-b-none"></span> </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">超链接地址</label>
              <div class="col-sm-8">
                <input name="url" class="form-control" type="text" placeholder="请输入超链接地址"/>
                <span class="help-block m-b-none"></span> </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">父级栏目</label>
              <div class="col-sm-8"> #{$parentID}# <span class="help-block m-b-none"></span> </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">排位序号</label>
              <div class="col-sm-8">
                <input name="sort" class="form-control" type="digits" placeholder="栏目排序号"/>
                <span class="help-block m-b-none"></span> </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">是否启用</label>
              <div class="col-sm-8">
                <div class="checkbox i-checks">
                  <input type="checkbox" name="visible" value="1" >
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-offset-2 col-sm-8">
                <button class="btn  btn-w-m btn-info save-form" type="button">保存数据</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
<script src="#{$smarty.const.APP}#/View/template/js/content.js?v=1.0.0"></script> 
<script>
$(document).ready(function () {
	$('.i-checks').iCheck({
		checkboxClass: 'icheckbox_square-green',
		radioClass: 'iradio_square-green',
	});
	//数据保存
	$("body").on("click", ".save-form", function() {
		FormData=$("form").serialize();
		$.ajax({
			type: "POST",
			url: "#{$smarty.const.ACT}#/sysmanage/Menu/menu_add/",
			data:FormData,
			dataType:"json",
			success: function(data){
				if(data.statusCode=='200'){
					layer.msg('操作成功', {icon: 1}); 		
				}
			},    
			complete: function() {   
				setTimeout(function(){
					//关闭窗口
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
					parent.layer.close(index);
				 },800);
   		  },
		});		
	});
});

</script>
</body>
</html>
